﻿<Window x:Class="LaunchMeNot.WinOptions"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:lex="http://schemas.root-project.org/xaml/presentation"
    xmlns:props="clr-namespace:LaunchMeNot.Properties" 
    xmlns:l49ui="clr-namespace:Lime49.UI;assembly=Lime49"
    xmlns:l49="clr-namespace:Lime49;assembly=Lime49"
    l49:WindowService.EscapeClosesWindow="True"
    MinWidth="150" Width="400" MinHeight="150" Height="300" SizeToContent="Height"
    Title="{lex:LocText LaunchMeNot.Core:Strings:Options}"
    Style="{StaticResource {x:Type Window}}" Icon="pack://application:,,,/Resources/icon.ico">
    <Window.CommandBindings>
        <CommandBinding Command="ApplicationCommands.Close" Executed="CloseWindow"/>
        <CommandBinding Command="ApplicationCommands.Open" Executed="Browse"/>
        <CommandBinding Command="ApplicationCommands.Save" Executed="Save"/>
    </Window.CommandBindings>
    <Window.Resources>
        <props:Settings x:Key="settings"/>
    </Window.Resources>
    <DockPanel Margin="6" Grid.IsSharedSizeScope="True">
        <StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button x:Name="btnSave" MinWidth="70" IsDefault="True" Command="ApplicationCommands.Save" Content="{lex:LocText LaunchMeNot.Core:Strings:Save}"/>
            <Button x:Name="btnCancel" MinWidth="70" IsCancel="True" Command="ApplicationCommands.Close" Margin="2,2,0,2" Content="{lex:LocText LaunchMeNot.Core:Strings:Cancel}"/>
        </StackPanel>
        
        <Grid DockPanel.Dock="Top" DataContext="{StaticResource settings}">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" SharedSizeGroup="labels"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            
            <Label Grid.Row="0" Grid.Column="0" Content="{lex:LocText LaunchMeNot.Core:Strings:ConfigurationPath}" />
            <TextBox x:Name="txtFilePath" Grid.Row="0" Grid.Column="1" TabIndex="1" Text="{Binding Default.FilePath,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                     ToolTip="{lex:LocText LaunchMeNot.Core:Strings:PathToDefaultAutoLaunchConfig}"/>
            <Button x:Name="btnBrowse" Grid.Row="0" Grid.Column="2" TabIndex="2" MinWidth="70" Command="ApplicationCommands.Open" CommandTarget="{Binding ElementName=txtFilePath}" Content="{lex:LocText LaunchMeNot.Core:Strings:Browse}" />
            
            <Label Grid.Row="1" Grid.Column="0" Content="{lex:LocText LaunchMeNot.Core:Strings:CountdownFormat}" />
            <TextBox x:Name="txtCountdownFormat" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" TabIndex="4" Text="{Binding Default.CountdownFormat,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                     ToolTip="{lex:LocText LaunchMeNot.Core:Strings:CountdownFormatDesc}"/>

            <Label Grid.Row="2" Grid.Column="0" Content="{lex:LocText LaunchMeNot.Core:Strings:AutoLaunchDelay}" />
            <l49ui:MaskedTextBox x:Name="txtAutoLaunchDelay" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" Width="60" HorizontalAlignment="Left" TabIndex="5" Type="DigitsWithDecimalPoint" 
                                 Text="{Binding Default.AutoLaunchDelay,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" ToolTip="{lex:LocText LaunchMeNot.Core:Strings:AutoLaunchDelayDesc}"/>
            
            <Label Grid.Row="3" Grid.Column="0" Content="{lex:LocText LaunchMeNot.Core:Strings:DefaultDelay}" />
            <l49ui:MaskedTextBox x:Name="txtDefaultLaunchDelay" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2" Width="60" HorizontalAlignment="Left" TabIndex="6" Type="DigitsWithDecimalPoint"
                                 Text="{Binding Default.DefaultLaunchDelay,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" ToolTip="{lex:LocText LaunchMeNot.Core:Strings:DefaultDelayDesc}"/>

            <CheckBox x:Name="chkLaunchWindowAOT" Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="3" TabIndex="7" Content="{lex:LocText LaunchMeNot.Core:Strings:KeepLaunchWindowOnTop}" IsChecked="{Binding Default.AutoLaunchAOT,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
            
            <CheckBox x:Name="chkAllowCloseLaunchWindow" Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="3" TabIndex="7" Content="{lex:LocText LaunchMeNot.Core:Strings:AllowAbortAutoLaunch}" IsChecked="{Binding Default.AllowCancelAutoLaunch,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
            
            <CheckBox x:Name="chkCloseAfterAutoLaunch" Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="3" TabIndex="8" Content="{lex:LocText LaunchMeNot.Core:Strings:CloseWindowAfterAutoLaunch}" IsChecked="{Binding Default.CloseAfterAutoLaunch,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
            
            <GroupBox Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="3" Header="{lex:LocText LaunchMeNot.Core:Strings:AutoLaunchLog}">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" SharedSizeGroup="labels"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    
                    <CheckBox x:Name="chkAutoLaunchLog" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" TabIndex="9" Content="{lex:LocText LaunchMeNot.Core:Strings:WriteAutoLaunchLog}" IsChecked="{Binding Default.AutoLaunchLog,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
                    <Label Grid.Row="1" Grid.Column="0" TabIndex="10" Content="{lex:LocText LaunchMeNot.Core:Strings:LogPath}" IsEnabled="{Binding IsChecked,ElementName=chkAutoLaunchLog}" />
                    <TextBox x:Name="txtAutoLaunchLogPath" Grid.Row="1" Grid.Column="1" TabIndex="11" Text="{Binding Default.AutoLaunchLogPath,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding IsChecked,ElementName=chkAutoLaunchLog}"/>
                    <Button x:Name="btnBrowseLog" Grid.Row="1" Grid.Column="2" TabIndex="12" MinWidth="70" Command="ApplicationCommands.Open" CommandTarget="{Binding ElementName=txtAutoLaunchLogPath}" Content="{lex:LocText LaunchMeNot.Core:Strings:Browse}" IsEnabled="{Binding IsChecked,ElementName=chkAutoLaunchLog}" />
                </Grid>
            </GroupBox>
            
        </Grid>
    </DockPanel>
</Window>
